package com.lifesting.ganttviewer;

import java.util.Date;

import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;

import com.lifesting.ganttviewer.model.GDuration;
import com.lifesting.ganttviewer.model.GProject;
import com.lifesting.ganttviewer.model.GTask;

public class Test {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Display display = new Display();
		Shell window = new Shell(display);
		window.setText("GanttViewer");
		window.setSize(1024,768);
		GProject project = new GProject();
		GTask task = new GTask();
		task.setName("Hello world");
		task.setCompleted(10);
		task.setStart(new Date());
		task.setFinish(new Date());
		task.setId(1);
		task.setPriority(1000);
		GDuration gd = new GDuration();
		gd.setLabel("3d?");
		task.setDuration(gd);
		project.addSubItem(task);
		
		GTask task2 = new GTask();
		task2.setName("Foo");
		task2.setCompleted(20);
		task2.setStart(new Date());
		task2.setFinish(new Date());
		task2.setId(2);
		task2.setPriority(2000);
		GDuration gd2 = new GDuration();
		gd2.setLabel("40d?");
		task2.setDuration(gd2);
		task.addSubItem(task2);
		GanttaViewer gv = new GanttaViewer(window);
		gv.setProject(project);
		window.setLayout(new FillLayout());
		window.open();
		while (!window.isDisposed()){
			if (!display.readAndDispatch()){
				display.sleep();
			}
		}
		window.dispose();
		display.dispose();
	}

}
